<include file="Public/min-header"/>
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
  <include file="Public/breadcrumb"/>
  <style type="text/css">
  	.table input{display: nones;}
	#biaozhu{cursor: pointer;}
	#yc{color:red; display: nones;}
  </style>
   <script type="text/javascript">
   jQuery.fn.rowspan = function(colIdx) { //封装的一个JQuery小插件  
   return this.each(function(){ 
   var that; 
   $('tr', this).each(function(row) { 
   $('td:eq('+colIdx+')', this).filter(':visible').each(function(col) { 
   if (that!=null && $(this).html() == $(that).html()) { 
   rowspan = $(that).attr("rowSpan"); 
   if (rowspan == undefined) { 
   $(that).attr("rowSpan",1); 
   rowspan = $(that).attr("rowSpan"); } 
   rowspan = Number(rowspan)+1; 
   $(that).attr("rowSpan",rowspan); 
   $(this).hide(); 
   } else { 
   that = this; 
   } 
   }); 
   }); 
   }); 
   }
   
   $(function() {
   	$(".g_list").rowspan(3);
   	$(".g_list").rowspan(4);
	// $(".g_list").rowspan(6);
	$(".g_list").rowspan(8);
   }); 
   
   </script>
  <section class="content">
    <div class="container-fluid">
      <div class="panel panel-default"> 
        <div class="panel-heading"> 
          <h3 class="panel-title"><i class="fa fa-list"></i>配送单总单对账<!-- <span style="color: red;font-size: 18px;">未开发完成的版本，切勿直接使用</span> --></h3>
        </div>
        <div class="panel-body">    
		<div class="navbar navbar-default">
                <form id="search-form2" class="navbar-form form-inline"  method="get" action="{:U('pda_new')}">
                <div class="form-group">
                  <div class="input-group">
                    <input type="text" class="form-control" id="order_sn" placeholder="订单号" value="{$Think.request.order_sn}" name="order_sn" style="width:150px;"/>
                  </div>

					<div class="form-group">
						<div class="input-group">
							<input type="text" name="duizhang_sn" id="duizhang_sn" placeholder="对账总单号" id="input-duizhang_sn" class="form-control" value="{:I('duizhang_sn')}" style="width:150px;">
						</div>
					</div>
                  <div class="input-group">
                    <input type="text" class="form-control" id="shanghu" placeholder="商户名" value="{$Think.request.shanghu}" name="shanghu" style="width: 100px;"/>
                  </div>
				  <div class="input-group">
				    <input type="text" class="form-control" id="kehu" placeholder="客户名" value="{$Think.request.kehu}" name="kehu" style="width: 100px;"/>
				  </div>

					<div class="form-group">
						<div class="input-group">
							<input type="text" name="driver" id="driver" placeholder="司机" id="input-driver" class="form-control" value="{:I('driver')}" style="width:100px;">
						</div>
					</div>

					<div class="form-group">
						<div class="input-group">
							<input type="text" name="biaoshi_xian" id="biaoshi_xian" placeholder="路线" id="input-b1" class="form-control" value="{:I('biaoshi_xian')}" style="width:100px;">
						</div>
					</div>

					<div class="form-group">
						<select name="shoukuan" id="shoukuan" class="form-control">
							<?php
										if(I('shoukuan')=='0'){
											echo '<option value="">全状态</option>
							<option value="0" selected="selected">未收款</option>
							<option value="1">已收款</option>';
							}elseif(I('shoukuan')=='1'){
							echo '<option value="">全状态</option>
							<option value="0">未收款</option>
							<option value="1" selected="selected">已收款</option>';
							}else{
							echo '<option value="" selected="selected">全状态</option>
							<option value="0">未收款</option>
							<option value="1">已收款</option>';
							}
							?>
						</select>
					</div>

					<div class="form-group">
						<select name="tag" id="tag" class="form-control">
							<?php
							if(I('tag')=='1'){
								echo '<option value="">是否回款</option>
							<option value="1" selected="selected">未回款</option>
							<option value="2">已回款</option>';
							}elseif(I('tag')=='2'){
							echo '<option value="">是否回款</option>
							<option value="1">未回款</option>
							<option value="2" selected="selected">已回款</option>';
							}else{
							echo '<option value="" selected="selected">是否回款</option>
							<option value="1">未回款</option>
							<option value="2">已回款</option>';
							}
							?>
						</select>
					</div>
					
					<!--<div class="form-group">-->
					<!--	<select name="order_status_title" id="order_status_title" class="form-control">-->
					<!--		<option value="" >选择是否自动</option>-->
					<!--		<option value="1" <if condition="I('order_status_title') eq 1">selected</if>>不是</option>-->
					<!--		<option value="2" <if condition="I('order_status_title') eq 2">selected</if>>自动收款</option>-->
					<!--		<option value="3" <if condition="I('order_status_title') eq 3">selected</if>>已经收款</option>-->
					<!--	</select>-->
					<!--</div>-->
                  
                   <div class="input-group margin" style="width: 250px;">                    
                   <!-- <div class="input-group-addon">
                        入库时间<i class="fa fa-calendar"></i>
                    </div> -->
                       <input type="text" id="start_time" value="{$timegap}" autocomplete="off" name="timegap" class="form-control pull-right">
                  </div>
                </div>
                <div class="form-group">
                    <button class="btn btn-primary" id="button-filter search-order" type="submit"><i class="fa fa-search"></i> 筛选</button>
                </div>


					<div class="form-group">
						<button type="button" class="btn btn-default pull-right" id="daochu"><i class="fa fa-file-excel-o"></i>&nbsp;导出excel</button>
					</div>
					<!--					<br/><span style="color: red;">提示：特殊订单如果司机未回款，实回款填0.001。</span>-->
                </form>
			
          </div>
			<div>
				<table class="table table-bordered table-hover">
					<thead>
					<tr>
						<th class="sorting text-center">合计</th>
						<th class="sorting text-center">优惠金额</th>
						<th class="sorting text-center">应收金额</th>
						<th class="sorting text-center">退款金额</th>
						<th class="sorting text-center">司机应收</th>
						<th class="sorting text-center">订单总数</th>
					</tr>
					</thead>
					<tbody>
					<tr>
						<td align="center" style="color: #f00">￥{$sum_price}</td>
						<td align="center" style="color: #268e0c">￥{$coupon_price}</td>
						<td align="center" style="color: #00f">￥{$heji_price}</td>
						<td align="center" >￥<input type="text" id="tuihuo_price" value="" style="width: 150px" placeholder="输入司机退款金额"/></td>
						<td align="center" style="color: #f00" id="siji_yinshou">{$heji_price}</td>
						<td align="center" style="color: #00f">{$order_count}</td>
					</tr>
					</tbody>
				</table>
			</div>
          <div id="ajax_return" class="g_list"> 
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>
								<th class="sorting text-center">选择</th>
								<th class="sorting text-center">订单号</th>
								<th class="sorting text-center">商户名</th>
								<th class="sorting text-center">司机</th>
                                <th class="sorting text-center">客户名</th>
								<th class="sorting text-center">订单价</th>
								<th class="sorting text-center">抹零金额</th>
								<th class="sorting text-center">优惠金额</th>
								<th class="sorting text-center">客户应收</th>
<!--								<th class="sorting text-center">现金</th>-->
<!--								<th class="sorting text-center">扫码支付</th>-->
								<th class="sorting text-center">包装件数</th>
								<th class="sorting text-center">入库时间</th>
<!--                                <th class="sorting text-center">退货</th>-->
								<th class="sorting text-center">物流状态</th>
								<th class="sorting text-center">状态/标注</th>
								<!--<th class="sorting text-center">是否自动收款</th>-->
                                <th class="sorting text-center">操作</th>
                            </tr>
                            </thead>
							<tbody>
								<tr style="font-size: 16px;color: red; display: none">
									<td colspan="5" align="right">合计：</td>
									<td align="center">￥{$heji_price}</td>
									<td align="center"></td>
									<td align="center"></td>
									<td align="center"></td>
									<td align="center"></td>
									<td colspan="4"></td>
								</tr>
							</tbody>
                            <tbody id="tbody">

                            <volist name="list" id="v">
	
								<volist name="v.order_list" id="vs">
									<?php
									$class=$vs['ruku']!=$vs['chuku'] ? '#e8e62d' : '';
									?>
                               <tr style="background:{$class}">
									<td class="text-center" id="biaozhus" rel="{$vs.order_id}">
										<input type="checkbox" name="alluser_id[]" title="批量收款" value="{$vs.order_id}|{$vs.store_id}">
										</td>
									<td class="text-center">
										<a href="javascript:" id="chakan" rel="{$vs.order_id}" rev="{$vs.store_id}">
										{$vs.order_sn}<?php if($vs['dai_type'] ==2) echo '<span style="color:#ff9800">特殊</span>'?>
										</a>
									</td>
                                    <td class="text-center">
                                            {$store_list[$vs[store_id]]}
                                    </td>
								   <td class="text-center">
                                            {$v.driver_name}
                                    </td>
                                    <td class="text-center">
                                             （{$v.biaoshi_xian}）{$vs.company}<span id="yc">{$vs.user_id}</span>
                                    </td>
									<td class="text-center"><span style="color:#f39c12;">{$vs.order_amount}<span id="yc">{$vs.user_id}</span></span></td>
								   <td class="text-center"><span style="color:#268e0c;"><input type="text" onchange="updateSort('order','order_id','{$v.order_id}','change',this)"  value="{$vs.change}" class="input-sm" style="width: 50px;text-align: center;" /></span></td>
								   <td class="text-center"><span style="color:#268e0c;">{$vs.coupon_price}</span></td>
								   <td class="text-center"><span id="yc">{$v.xiaoji}</span></td>

<!--									<td class="text-center"><input type="text" onchange="updateSort('order','order_id','{$vs.order_id}','pda_offline',this)" class="form-control" value="{$vs.pda_offline}" style="width:100px;"></td>-->

<!--									<td class="text-center"><input type="text" class="form-control" value="{$vs.pda_online}" style="width:100px;"></td>-->
									<td class="text-center"><b>{$vs.chuku}件</b></td>
									<td class="text-center"><b>{$vs.ruku_last_time|date='Y-m-d H:i',###}</b></td>
<!--									<td class="text-center"><a href="JavaScript:;" data-toggle="tooltip" id="tuihuo" class="btn btn-primary" data-original-title="退货'" rel="{$vs.order_id}" rev="{$vs.order_sn}"><i class="fa fa-pencil">退货</i></a></td>-->
									<td class="text-center">
										<select onchange="act_change_submit('zhuangtai','{$vs.order_id}',this)" class="input-sm">
											<option value="" selected>默认状态</option>
											<option value="1">没货</option>
											<option value="2">次日送</option>
										</select>
									</td>
									<td class="text-center" id="hui_{$v.order_id}">
										<if condition="$vs['tag_price'] eq '0'">
									    &nbsp;<i class="glyphicon glyphicon-flag" id="biaozhu" rel="0" title="标注未回款单据">未回款</i>
										<else/>
										&nbsp;<i class="glyphicon glyphicon-flag" id="biaozhu" rel="1" title="恢复未回款单据" style="color:red;">未回款</i>
										</if>
									</td>
									<!--<td class="text-center" >-->
									<!--	<if condition="$vs['order_status_title'] eq 1">-->
									   <!--<span onclick="kuan('{$vs['order_id']}')">自动收款</span>-->
									<!--   <button id="act_button" type="button" onclick="kuan('{$vs['order_id']}')" class="btn btn-primary" style="margin-left:15px;"><i class="fa"></i>收款</button>-->
									<!--	<elseif condition="$vs['order_status_title'] eq 0"/>-->
									<!--    <span>不是</span>-->
									<!--    <elseif condition="$vs['order_status_title'] eq 2"/>-->
									<!--    <span style="color:red;">已经收款</span>-->
									   
									<!--	</if>-->
									<!--</td>-->
								   <td class="text-center" id="tr_{$vs.order_id}">
									   <if condition="$vs['is_checkout'] eq '0'">
										   <?php
												if(session('role_id')==1 || session('role_id') == 191 ){
											?>
										   <a href="javascript:" data-toggle="tooltip" rel="{$vs.order_id}" rev="{$vs.store_id}" class="btn btn-warning" id="queren">确定收款 <i class="fa fa-pencil"></i></a>
										   <?php }?>
										   <else/>
										   <a href="javascript:" data-toggle="tooltip" style="pointer-events:none;color:green" class="btn btn-default" id="queren">已经收款 <i class="fa fa-check"></i></a>
									   </if>
								   </td>
                                </tr>
								</volist>
                            </volist>
                            </tbody>
                        </table>
                    </div>

                <div class="row">
                    <div class="col-sm-6 text-left">
                        全选
                        <input type="checkbox" onclick="$('input[name=\'alluser_id\[\]\']').prop('checked', this.checked);">
<!--                        <button id="act_button" type="button" onclick="act_submit('zhuangtai',0);" class="btn btn-primary" style="margin-left:15px;"><i class="fa"></i>默认状态</button>-->
						<button  onclick="fanxuan()" type="button"  class="btn" style="margin-left:15px;"><i class="fa"></i>反选</button>
						<button id="act_button" type="button" onclick="act_submit('zhuangtai',1);" class="btn btn-primary" style="margin-left:15px;"><i class="fa"></i>没货</button>
						<button id="act_button" type="button" onclick="act_submit('zhuangtai',2);" class="btn btn-primary" style="margin-left:15px;"><i class="fa"></i>次日送</button>
                        <button id="hui_button" type="button" onclick="act_submit('yes','');" class="btn btn-danger" style="margin-left:15px;"><i class="fa"></i> 批量回款</button>
						<button id="act_button" type="button" onclick="act_shoukuan();" class="btn btn-warning" style="margin-left:15px;"><i class="fa"></i> 批量收款</button>
						<!--<button id="act_button" type="button" onclick="act_shoukuan2();" class="btn btn-primary" style="margin-left:15px;"><i class="fa"></i> 批量收款2</button>-->
                    </div>
                    <div class="col-sm-6 text-right">{$show}</div>
                </div>
          </div>
        </div>
      </div>
    </div>


	  <style>
		  #jisuanqi{display: none;}
		  #jisuanqi div{float:left;margin-left:6px;}
		  #jisuanqi input{width:70px;}
	  </style>
	  <div id="jisuanqi">
		  <table class="table table-bordered table-hover">
			  <thead>
			  <tr>
				  <th class="sorting text-center">合计</th>
				  <th class="sorting text-center">优惠金额</th>
				  <th class="sorting text-center">应收金额</th>
				  <th class="sorting text-center">退款金额</th>
				  <th class="sorting text-center">司机应收金额</th>
				  <th class="sorting text-center">未到账</th>
			  </tr>
			  </thead>
			  <tbody>
			  <tr>
				  <td align="center" style="color: #f00">￥{$sum_price}</td>
				  <td align="center" style="color: #268e0c">￥{$coupon_price}</td>
				  <td align="center" style="color: #00f">￥{$heji_price}</td>
				  <td style="width: 150px;">￥<input type="text" value="" id="return_price" style="width: 100px"></td>
				  <td style="width: 150px;">￥<input type="text" value="{$heji_price}" id="driver_price" style="width: 100px"></td>
				  <td align="center" width="150" id="last_price" style="color: #f00">￥0</td>
			  </tr>
			  </tbody>
		  </table>
	  </div>

    <!-- /.row --> 
  </section>
  <!-- /.content --> 
</div>
<!-- /.content-wrapper --> 
 <script>
	$(document).ready(function() {
		$("#tuihuo_price").on('input',function(e){
			var heji_price = '{$heji_price}'

			var shu1 = heji_price - $(this).val();

			$('#siji_yinshou').html('￥'+shu1.toFixed(2));
			//$('#driver_price').html('￥'+driver_pricebiaozhu.toFixed(2));
		});

		$('#start_time').daterangepicker({
			format:"YYYY-MM-DD HH:mm",
			singleDatePicker: false,
			showDropdowns: true,
			minDate:'2015-01-01 00:00',
			maxDate:'2030-01-01 00:00',
			startDate:'{:date("Y-m-d")} 00:00',
			showWeekNumbers: true,
			timePicker: true,
			timePickerIncrement: 1,
			timePicker12Hour: false,
			opens: 'right',
			buttonClasses: ['btn btn-default'],
			applyClass: 'btn-small btn-primary',
			cancelClass: 'btn-small',
			locale : {
				applyLabel : '确定',
				cancelLabel : '取消',
				fromLabel : '起始时间',
				toLabel : '结束时间',
				customRangeLabel : '自定义',
				daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
				monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ],
				firstDay : 1
			}
		});

		$(".table #biaozhu").click(function(){
			layer.load();
			var obj=$(this).parent().parent();
			var zhi=$(this).attr('rel');var order_id=obj.find('#chakan').attr('rel');var new_rel='';
			if(zhi=='0'){
				new_rel='1';
				obj.find('#biaozhus').html('');
				$(this).css('color','red');$(this).attr('rel',new_rel);
				//obj.find('input').val('0.001');
				//$.get('/index.php?m=Admin&c=Index&a=changeTableVal&table=order&id_name=order_id&id_value='+order_id+'&field=shi_price&value=0.001',function(res){ });
			}else{
				new_rel='0';
				var xuanzhe=obj.find('#biaozhus').attr('rel');
				obj.find('#biaozhus').html('<input type="checkbox" name="alluser_id[]" title="批量收款" value="'+xuanzhe+'">');
				$(this).css('color','#000');$(this).attr('rel',new_rel);
				//obj.find('input').val('0.000');
				//$.get('/index.php?m=Admin&c=Index&a=changeTableVal&table=order&id_name=order_id&id_value='+order_id+'&field=shi_price&value=0.000',function(res){ });
			}
			$.post('/index.php/Admin/Finance/pda',{biaozhu:'biaozhu',order_id:order_id,tag_price:new_rel},function(res){
				layer.closeAll('loading');
			});
		});
	
$(".table-responsive #chakan").click(function(){
				var myrel=$(this).attr('rel');
		 		var store_id=$(this).attr('rev');
				layer.load();
		 		var myrul='/index.php/Seller/Admin/login/store_id/'+store_id;//+myrel;
		 		$.get(myrul,function(e){
					layer.closeAll('loading');
		 			layer.open({
		 			  type: 2,
		 			  shadeClose: true, //点击遮罩关闭
		 			  title:'商家产品信息',
		 			  skin: 'layui-layer-rim', //加上边框
		 			  area: ['80%', '80%'], //宽高
		 			  content: '/Seller/order/edit_order/order_id/'+myrel
		 			});
		 		})
    });


		// layer.open({
		// 	type: 1, //Layer提供了5种层类型。可传入的值有：0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）,
		// 	title: '[对账] 计算器', //标题
		// 	area: ['800px', '145px'],   //宽高
		// 	offset: ['8px', '45%'],
		// 	maxmin: true,
		// 	shade: 0,   //遮罩透明度
		// 	content: $("#jisuanqi"),//支持获取DOM元素
		// 	scrollbar: true ,//屏蔽浏览器滚动条
		// });

		$("#daochu").click(function(){
			layer.load();
			var order_sn=$("#order_sn").val();
			var kehu=$("#kehu").val();
			var shanghu=$("#shanghu").val();
			var tag=$("#tag").val();
			var driver=$("#driver").val();
			var biaoshi_xian=$("#biaoshi_xian").val();
			var shoukuan=$("#shoukuan").val();
			var fast_flag=$("#fast_flag").val();
			var start_time=$("#start_time").val();
			var duizhang_sn=$("#duizhang_sn").val();
			var url = "/index.php/Admin/Finance/export_pdaqd?order_sn="+order_sn+"&kehu="+kehu+"&timegap="+start_time+"&shanghu="+shanghu+"&tag="+tag+"&fast_flag="+fast_flag+"&driver="+driver+"&biaoshi_xian="+biaoshi_xian+"&duizhang_sn="+duizhang_sn+"&shoukuan="+shoukuan


			$.ajax({
				type: "GET",
				url: url,
				dataType: "json",//后台处理后返回的数据格式
				success: function (data){
					console.log(data)
					var $a = $("<a>");
					$a.attr("href", data.file);
					$a.attr("download", data.filename);
					$("body").append($a);
					$a[0].click();
					$a.remove();
					layer.closeAll('loading');
				},
				error: function (msg){
				}
			})
		})
		
    $(".table-responsive #tuihuo").click(function(){
		var order_sn=$(this).attr('rev');
        var myrul='/index.php?m=admin&c=Order&a=tuihuo_edit_order&order_sn='+order_sn;//+myrel;
        layer.open({
            type: 2,
            shadeClose: true, //点击遮罩关闭
            title:'添加退货',
            skin: 'layui-layer-rim', //加上边框
			area: ['80%', '100%'], //宽高
            content: myrul
        });
		 });
				
    $(".table-responsive #bianji").click(function(){
        var myrul='/index.php/Seller/Goods/batch_edit_price';//+myrel;
        layer.open({
            type: 2,
            shadeClose: true, //点击遮罩关闭
            title:'批量修改价格/库存',
            skin: 'layui-layer-rim', //加上边框
            area: ['80%', '60%'], //宽高
            content: myrul
        });
		 });
});

    function get_select_order_id_str() {
        if ($('input[name="alluser_id\[\]"]:checked').length == 0)
            return false;
        var goods_arr = Array();
        $('input[name="alluser_id\[\]"]:checked').each(function () {
            goods_arr.push($(this).val());
        });
        var order_id_str = goods_arr.join(',');
        return order_id_str
    }
	
    //批量操作提交
    function act_submit(action="",str="") {
        //prompt层
        var ids = get_select_order_id_str();
        if (ids == false) {
            layer.alert('请勾选要操作的订单', {icon: 2});
            return;
        }
		
		console.log(ids); 
		layer.confirm('确定操作吗？', {
			btn: ['确定','取消'] //按钮
		}, function(){
			$.post('/index.php/Admin/Finance/pda_new',{action:action,datas:ids,str:str},function(res){
				console.log(res)
					location.reload();
					// layer.msg('状态修改成功！', {icon:6},function(){
						
					// });
			});
		});
    }


    //批量操作提交
    function act_change_submit(action="",ids="",e) {
    	var type = $(e).val()
		layer.confirm('确定操作吗？', {
			btn: ['确定','取消'] //按钮
		}, function(){
			$.post('/index.php/Admin/Finance/pda_new',{action:action,datas:ids,str:type},function(res){
				console.log(res)
					location.reload();
					// layer.msg('状态修改成功！', {icon:6},function(){

					// });
			});
		},function (){
			location.reload();
		});
    }


	$(".table #queren").click(function(){
		var myid=$(this).attr('rel');
		var store_id=$(this).attr('rev');
		var obj=$(this).parent();
		var than=$(this);
		layer.confirm('确定收款吗？确认收款后会结算给商家。', {
			btn: ['确定','取消'] //按钮
		}, function(){
			$.post('/index.php/Admin/Finance/pda',{action:'yes',order_id:myid,store_id:store_id},function(res){
				if(res==''){
					layer.msg('收款&结算成功！', {icon:6});
					than.remove();
					obj.html('<a href="javascript:" data-toggle="tooltip" style="pointer-events:none;color:green" class="btn btn-default" id="queren">已经收款 <i class="fa fa-check"></i></a>');
				}
			});

		});
	});


	//批量操作提交
	function act_shoukuan() {
		layer.load()
		//prompt层
		var ids = get_select_order_id_str();
		if (ids == false) {
			layer.alert('请勾选要操作的订单', {icon: 2});
			return;
		}
		console.log(ids);
		layer.confirm('确定收款吗？确认收款后会结算给商家。', {
			btn: ['确定','取消'] //按钮
		}, function(){
			$.post('/index.php/Admin/Finance/pda_piliang',{action:'yes',datas:ids},function(res){
				if(res!=''){
					res=res.slice(0,res.length-1);
					res=res.split(',');
					for(var i=0;i<res.length;i++){
						$('.table-bordered #tr_'+res[i]).html('<a href="javascript:" data-toggle="tooltip" style="pointer-events:none;color:green" class="btn btn-default" id="queren">已经收款 <i class="fa fa-check"></i></a>');
					}
					layer.closeAll('loading');
					layer.msg('收款&结算成功！', {icon:6},function(){
						//location.reload();
					});
				}
			});

		});
	}
	//批量操作提交
	function act_shoukuan2() {
		layer.load()
		//prompt层
		var ids = get_select_order_id_str();
		if (ids == false) {
			layer.alert('请勾选要操作的订单', {icon: 2});
			return;
		}
		console.log(ids);
		layer.confirm('确定收款吗？', {
			btn: ['确定','取消'] //按钮
		}, function(){
			$.post('/index.php/Admin/Finance/pda_piliang2',{datas:ids},function(res){
			    console.log(res.code)
				if(res  != 1){
				// 	res=res.slice(0,res.length-1);
				// 	res=res.split(',');
				// 	for(var i=0;i<res.length;i++){
				// 		$('.table-bordered #tr_'+res[i]).html('<a href="javascript:" data-toggle="tooltip" style="pointer-events:none;color:green" class="btn btn-default" id="queren">已经收款 <i class="fa fa-check"></i></a>');
				// 	}
					layer.closeAll('loading');
					layer.msg('收款成功！', {icon:6},function(){
						location.reload();
					});
				}
			});

		});
	}

	function fanxuan(){
		$("#tbody input").each(function(i){
			const mark = $("#tbody input").eq(i).prop("checked");

			if(mark==true){
				$("#tbody input").eq(i).prop("checked",false);
			}else if(mark==false){
				$("#tbody input").eq(i).prop("checked",true);
			}
		});
	}
	
	function kuan(order_id){
	    layer.confirm('确定收款吗?', {
			btn: ['确定','取消'] //按钮
		}, function(){
			$.post('/index.php/Admin/Finance/financeKuan',{order_id:order_id},function(res){
				location.reload();
			});

		});
	}


 </script>
</body>
</html>